#ifndef __MACRO_H__
#define __MACRO_H__

#include <string.h>
#include <assert.h>
#include "util.h"
#include "log.h"

#define DO_ASSERT(x)\
	if(!(x)) \
	{\
		LOG_ERROR(LOG_ROOT()) << "ASSERTION: " #x\
			<< "\nbacktrace:\n"\
			<< johnsonli::BacktraceToString(100, 0, "    ");\
		assert(x);\
	}

#define DO_ASSERT2(x,w)\
	if(!(x)) \
	{ \
		LOG_ERROR(LOG_ROOT()) << "ASSERTION: " #x \
			<< "\n" << #w \
			<< "\nbacktrace:\n" \
			<< johnsonli::BacktraceToString(100, 0, "    "); \
		assert(x); \
	}


#endif // !__MACRO_H__

